package com.nbsaas.boot.iot.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.util.Date;

/**
 * IoT设备实体类
 * 
 * @author 系统生成
 */
@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "IoT设备", model = "IoT设备")
@Entity
@Table(name = "bs_iot_device")
@Comment("IoT设备表")
public class IotDevice extends AbstractEntity {

    @Comment("设备编码")
    @SearchItem(name = "deviceCode", key = "deviceCode", label = "设备编码")
    @FormField(title = "设备编码", sortNum = "1", grid = true, required = true)
    @Column(name = "device_code", length = 50, nullable = false, unique = true)
    private String deviceCode;

    @Comment("设备名称")
    @SearchItem(name = "deviceName", key = "deviceName", label = "设备名称")
    @FormField(title = "设备名称", sortNum = "2", grid = true, required = true)
    @Column(name = "device_name", length = 100, nullable = false)
    private String deviceName;

    @Comment("设备类型")
    @SearchItem(name = "deviceType", key = "deviceType", label = "设备类型")
    @FormField(title = "设备类型", sortNum = "3", grid = true, type = InputType.select)
    @Column(name = "device_type", length = 50)
    private String deviceType; // SENSOR-传感器, ACTUATOR-执行器, CONTROLLER-控制器, GATEWAY-网关, CAMERA-摄像头

    @Comment("设备分类")
    @FormField(title = "设备分类", sortNum = "4", grid = true, type = InputType.select)
    @Column(name = "device_category", length = 50)
    private String deviceCategory; // PRODUCTION-生产设备, WAREHOUSE-仓储设备, LOGISTICS-物流设备, ENVIRONMENT-环境设备

    @Comment("位置ID")
    @FormField(title = "位置ID", sortNum = "5", grid = true, type = InputType.select)
    @Column(name = "location_id")
    private Long locationId;

    @Comment("制造商")
    @FormField(title = "制造商", sortNum = "6", grid = true)
    @Column(name = "manufacturer", length = 100)
    private String manufacturer;

    @Comment("设备型号")
    @FormField(title = "设备型号", sortNum = "7", grid = true)
    @Column(name = "model", length = 100)
    private String model;

    @Comment("序列号")
    @FormField(title = "序列号", sortNum = "8", grid = true)
    @Column(name = "serial_number", length = 100)
    private String serialNumber;

    @Comment("安装日期")
    @FormField(title = "安装日期", sortNum = "9", type = InputType.date, grid = true)
    @Column(name = "installation_date")
    private Date installationDate;

    @Comment("保修到期日期")
    @FormField(title = "保修到期日期", sortNum = "10", type = InputType.date, grid = true)
    @Column(name = "warranty_expiry_date")
    private Date warrantyExpiryDate;

    @Comment("设备状态")
    @FormField(title = "设备状态", sortNum = "11", grid = true, type = InputType.select)
    @Column(name = "device_status", length = 20)
    private String deviceStatus; // ONLINE-在线, OFFLINE-离线, MAINTENANCE-维护中, FAULT-故障

    @Comment("IP地址")
    @FormField(title = "IP地址", sortNum = "12", grid = true)
    @Column(name = "ip_address", length = 15)
    private String ipAddress;

    @Comment("端口号")
    @FormField(title = "端口号", sortNum = "13", grid = true, type = InputType.el_input_number)
    @Column(name = "port_number")
    private Integer portNumber;

    @Comment("固件版本")
    @FormField(title = "固件版本", sortNum = "14", grid = true)
    @Column(name = "firmware_version", length = 50)
    private String firmwareVersion;

    @Comment("设备描述")
    @FormField(title = "设备描述", sortNum = "15", type = InputType.textarea)
    @Column(name = "description", length = 1000)
    private String description;
} 